<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------
namespace app\video\behavior\add_report_before;

/**
 * 校验是否已经点过赞
 * @package app\user_center\behavior\user
 * @author jason wang
 */
class checkReport{
    /**
     * 执行行为 run方法是Behavior唯一的接口
     * @access public
     * @return void
     */
    public function run($params){
    	$uid 	        = $params['user_id'];
    	$report_id      = $params['report_id'];
        $report_type    = $params['report_type'];
        switch ($report_type) {
            case 1://视频
				$video_info = model('video/VideoPlay') -> getPlayFatherPlayInfo($report_id);
				$report_id = $video_info['data'];//关联的视频id	
                $map = [];
                $map['uid']             = $uid;
                $map['report_type']     = $report_type;
                $map['play_id']         = $report_id;
                break;
            case 2://评论
                $map = [];
                $map['uid']             = $uid;
                $map['report_type']     = $report_type;
                $map['comment_id']      = $report_id;
                break;
            case 3://回复
                $map = [];
                $map['uid']             = $uid;
                $map['report_type']     = $report_type;
                $map['reply_id']        = $report_id;
                break;
            default:
                return array_out(-1005, 'error1');
                break;
        }
        if(model('VideoPlayReport') -> where($map) -> find()){
            return array_out(-1001, '您已经举报过了');
        }
        
        
    }
}
